package com.service.impl;


import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dao.CartMapper;
import com.entity.Cart;
import com.service.CartService;

import java.util.List;

/**
 * @program: ssm
 * @description: 璐墿杞﹀疄鐜�
 * @author: zl
 * @create: 2022-05-17 15:21
 **/

@Service("cart")
public class CartserviceImpl  implements CartService {

    @Autowired
    private CartMapper cartMapper;

    public void setCartMapper(CartMapper cartMapper){
        this.cartMapper=cartMapper;
    }

    public int addCart(Cart cart) {
        return cartMapper.addCart(cart);
    }

    public int deleteCart(@Param("cart_id") int cart_id) {
        return cartMapper.deleteCart(cart_id);
    }

    public int update(int cart_id, int good_num) {
        return cartMapper.update(cart_id,good_num);
    }

    public List<Cart> selectALl() {
        return cartMapper.selectALl();
    }

	@Override
	public List<Cart> selectCartByUserid(int userid) {
		return cartMapper.selectCartByUserid(userid);
	}

	@Override
	public int selectUserIdByCartId(int cart_id) {
		return cartMapper.selectUserIdByCartId(cart_id);
	}

	@Override
	public Cart selectCartByCartId(Integer cart_id) {
		// TODO Auto-generated method stub
		return cartMapper.selectCartByCartId(cart_id);
	}
	

}
